package son.nt.act2;

import java.util.ArrayList;

import son.nt.R;
import son.nt.adapter.ListviewAdapter;
import son.nt.entities.Song;

import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.ListView;

public class ListviewCustom extends ListActivity{
	ArrayList<Song> list ;
	Context mContext = null;
	private ListView listView = null;
	private ListviewAdapter adapter;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		overridePendingTransition(R.anim.slide_from_right, R.anim.slide_to_left);
		mContext = this;
		listView = getListView();
		list = new ArrayList<Song>();
		list.add(new Song("1", "Someone Like You", "Adele", "4:47", "adele"));
		list.add(new Song("2", "Space Bound", "Eminem", "4:38", "eminem"));
		list.add(new Song("3", "Love The Way You Lie", "Rihanna", "5:38", "rihanna"));
		
		adapter = new ListviewAdapter(mContext, list);
		listView.setAdapter(adapter);
	}
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		return super.onKeyDown(keyCode, event);
	}
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
//		overridePendingTransition(R.anim.hold, R.anim.push_out_to_left);
		overridePendingTransition(R.anim.slide_from_left, R.anim.slide_to_right);
	}
}
